package com.xixi.controller;

import com.xixi.pojo.dto.FavoriteDTO;
import com.xixi.pojo.vo.FavoriteVO;
import com.xixi.pojo.vo.Result;
import com.xixi.service.FavoriteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/favorite")
public class FavoriteController {
    @Autowired
    private FavoriteService favoriteService;
    @GetMapping("/listById/{id}")
    public Result listById(@PathVariable Integer id){
        List<FavoriteVO> list = favoriteService.listById(id);
        return Result.success(list);
    }
    @PostMapping("/insert")
    public Result insert(@RequestBody FavoriteDTO favoriteDTO){
        return favoriteService.insert(favoriteDTO);
    }
    @DeleteMapping("/delete")
    public Result delete(@RequestParam List<Integer> ids){
        return favoriteService.delete(ids);
    }
}
